﻿using System;

namespace Camstar.Utils.csv
{
    /// <summary>
    /// A enumerated set of behavioral options for a CsvReader.
    /// </summary>
    [Flags]
    public enum CsvOption
    {
        /// <summary>
        /// No options are specified.
        /// </summary>
        None = 0,
        /// <summary>
        /// When writing, add a CR character before each end of row character.
        /// </summary>
        AddCr = 1,
        /// <summary>
        /// Use two consecutive quoting characters to escape quotes within a column value.
        /// </summary>
        Double = 2,
        /// <summary>
        /// When reading, if a column value begins with equals, discard that character (for Excel formulas).
        /// </summary>
        Equals = 4,
        /// <summary>
        /// Allow the escape character within quoted column values.
        /// </summary>
        Escape = 8,
        /// <summary>
        /// Allow the escape character outside of quoted column values.
        /// </summary>
        FreeEscape = 16,
        /// <summary>
        /// When writing text, enclose it in an Excel formula by default.
        /// </summary>
        Formula = 32,
        /// <summary>
        /// When reading, ignore the CR character if it immediately precedes the end of row character.
        /// </summary>
        IgnoreCr = 64,
        /// <summary>
        /// Allow double quotes to enclose a column value (to escape reserved characters).
        /// </summary>
        Quote = 128,
        /// <summary>
        /// Allow single quotes to enclose a column value (to escape reserved characters).
        /// </summary>
        SingleQuote = 256,
        /// <summary>
        /// When reading, trim white space from the start and end of unquoted column values.
        /// </summary>
        Trim = 512,
        /// <summary>
        /// When writing, treat leading and trailing white space as characters that must be escaped.
        /// </summary>
        WhiteSpace = 1024,
        /// <summary>
        /// Allow a comment character.
        /// </summary>
        Comment = 2048,
        /// <summary>
        /// Limit comment characters to the first character of each line.
        /// </summary>
        CommentLine = 4096,
        /// <summary>
        /// Do not recognize comment characters when they are quoted or escaped.
        /// </summary>
        CommentQuote = 8192,
        /// <summary>
        /// Ignore rows consisting entirely of a row end sequence.
        /// </summary>
        EmptyLine = 16384,
        /// <summary>
        /// Allow both double and single quotes to enclose a column value (to escape reserved characters).
        /// </summary>
        AllQuote = Quote | SingleQuote,
        /// <summary>
        /// The default options.
        /// </summary>
        Default = IgnoreCr | Quote | Double | WhiteSpace
    }
}